﻿using System;
using Plugins;
using Plugins.UserControls;
using Utils;

namespace PluginSample2.Common
{
    [Serializable]
	internal class EngineSettingsBase : Plugins.Base.EngineSettingsBase, ICopyable<EngineSettingsBase>, ICloneable<EngineSettingsBase>
    {
		#region Attributes

    	protected readonly StrategyControlData _customOptions;

		#endregion

		#region Properties

		public bool InvertLogic
		{
			get { return _customOptions.InvertLogic; }
			set { _customOptions.InvertLogic = value; }
		}

		public ExecutionDirection ExecutionDirection
		{
			get { return _customOptions.ExecutionDirection; }
			set { _customOptions.ExecutionDirection = value; }
		}

		public TimeSpan BarDuration
		{
			get { return _customOptions.BarDuration; }
			set { _customOptions.BarDuration = value; }
		}

		public int BarQuantity
		{
			get { return _customOptions.BarQuantity; }
			set { _customOptions.BarQuantity = value; }
		}

		public BarSource BarSource
		{
			get { return _customOptions.BarSource; }
			set { _customOptions.BarSource = value; }
		}

		public bool RequirePureBars
		{
			get { return _customOptions.RequirePureBars; }
			set { _customOptions.RequirePureBars = value; }
		}

		public int QuantityToBuy
		{
			get { return _customOptions.QuantityToBuy; }
			set { _customOptions.QuantityToBuy = value; }
		}

		#endregion

		#region Public Methods

		public EngineSettingsBase(StrategyControlData customOptions, HourSelectorData hourOptions, StockSelectorData stockSelectionOptions, StockParametersSelectorData stockParameters) : base(hourOptions, stockSelectionOptions, stockParameters)
		{
			_customOptions = customOptions;
		}

		#endregion

		#region ICopyable

		public void Copy(EngineSettingsBase source)
		{
			_customOptions.Copy(source._customOptions);
			base.Copy(source);
		}

		#endregion

		#region ICloneable

		public new EngineSettingsBase Clone()
		{
			return new EngineSettingsBase(_customOptions.Clone(), _hourOptions.Clone(), _stockSelectionOptions.Clone(), _stockParameters.Clone());
		}

		#endregion
	}
}

